<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>Title</title>
    <script src="../../js/jquery-3.3.1.min.js" charset="utf-8"></script>
    <script src="../../js/cookie/jquery.cookie.js" charset="utf-8"></script>
    <script src="../../layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../layui-v2.2.5/layui/css/layui.css" media="all">
</head>
<body>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right;margin-right: 100px"  href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
<form class="layui-form" action="">
    <input type="hidden" name="orgId" id="orgId" value="${orgId}">
    <input type="hidden" name="activityId" id="activityId" value="${activityId}">
    <input type="hidden" name="id" id="id" value="${rule.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">活动推广剩余金额</label>
        <div class="layui-input-block">
            <input type="text" name="population" id="population" required value="${redRule.totalMoney}" disabled="disabled"
                   lay-verify="required|number"  autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">充值金额</label>
        <div class="layui-input-block">
            <input type="text" name="money" id="money" required value="1"
                   lay-verify="required|number" placeholder="充值金额" autocomplete="off" class="layui-input">
        </div>
    </div>

    <%--<div class="layui-form-item">--%>
    <%--<label class="layui-form-label">红包总金额</label>--%>
    <%--<div class="layui-input-block">--%>
    <%--<input type="text" name="totalMoney" id="totalMoney" required value="${rule.totalMoney/100}"--%>
    <%--lay-verify="required|number" placeholder="红包总金额" autocomplete="off" class="layui-input">--%>
    <%--</div>--%>
    <%--</div>--%>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use(['form', 'layedit'], function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.open({
                title:'微信充值二维码（微信需要收取0.6%的手续费）',
                type: 2,
                content: '/group/wxNativeQr?activityId=${activityId}&orgId=${orgId}&money='+$("#money").val(),
                offset: '5px',
                shade:[0.8, '#393D49'],
                shadeClose:true,
                area: ["40%","80%"],
                end:function () {
                    window.location.reload();
                }
            });

            <%--//layer.msg(JSON.stringify(data.field));--%>
            <%--console.log(JSON.stringify(data.field));--%>
            <%--$.ajax({--%>
                <%--url:'/group/wxNativeQr',--%>
                <%--type:'POST', //GET--%>
                <%--async:true,    //或false,是否异步--%>
                <%--data:{--%>
                    <%--money:data.field.money,--%>
                    <%--orgId:'${orgId}',--%>
                    <%--activityId:'${activityId}',--%>
                <%--},--%>
                <%--timeout:5000,    //超时时间--%>
                <%--dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text--%>
                <%--beforeSend:function(xhr){--%>
                    <%--/*console.log(xhr)--%>
                     <%--console.log('发送前')*/--%>
                <%--},--%>
                <%--success:function(data){--%>
                    <%--console.log(data);--%>
                    <%--if (data.code=='000000'){--%>
                        <%--layer.msg(data.msg,{time:1000,icon: 6},function () {--%>
                            <%--// 获得frame索引--%>
                            <%--var index = parent.layer.getFrameIndex(window.name);--%>
                            <%--//关闭当前frame--%>
                            <%--parent.layer.close(index);--%>
                        <%--});--%>
                    <%--}else {--%>
                        <%--layer.msg(data.msg,{time:1000,icon: 5});--%>
                    <%--}--%>
                    <%--//console.log(data)--%>
                <%--},--%>
                <%--error:function(xhr,textStatus){--%>
                    <%--console.log('错误')--%>
                    <%--console.log(xhr)--%>
                    <%--console.log(textStatus)--%>
                <%--},--%>
                <%--complete:function(){--%>
                    <%--//console.log('结束')--%>
                <%--}--%>
            <%--})--%>
            return false;
        });
    });
</script>


</body>
</html>
